]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Prefer g_string_free_and_steal instead of g_string_free
authorBilal Elmoussaoui <belmouss@redhat.com>
Tue, 14 Apr 2026 17:43:21 +0000 (19:43 +0200)
committerBilal Elmoussaoui <belmouss@redhat.com>
Wed, 15 Apr 2026 07:31:34 +0000 (09:31 +0200)
As that makes semantics clearer

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4176>

18 files changed:
src/gtkactionmuxer.c
src/shell-perf-log.c
src/st/croco/cr-additional-sel.c
src/st/croco/cr-attr-sel.c
src/st/croco/cr-declaration.c
src/st/croco/cr-fonts.c
src/st/croco/cr-parsing-location.c
src/st/croco/cr-pseudo.c
src/st/croco/cr-rgb.c
src/st/croco/cr-selector.c
src/st/croco/cr-simple-sel.c
src/st/croco/cr-statement.c
src/st/croco/cr-stylesheet.c
src/st/croco/cr-term.c
src/st/st-theme-node.c
src/st/st-widget.c
src/st/test-theme.c
src/tray/na-tray-child.c

index ec0f20ee9e7a5a10b756cfdedcf44b3c9187b497..c361d6084cac4cc32a50e13a35231a711386dd26 100644 (file)
@@ -941,5 +941,5 @@ gtk_print_action_and_target (const gchar *action_namespace,
 
   g_string_append (result, action_name);
 
-  return g_string_free (result, FALSE);
+  return g_string_free_and_steal (result);
 }
index 1de97f4fb5dd92906c04a4b0a8aabfec27fe0a72..4848088e256bd193a168ef949fe75f8c97077b22 100644 (file)
@@ -782,7 +782,7 @@ escape_quotes (const char *input)
         g_string_append_c (result, *p);
     }
 
-  return g_string_free (result, FALSE);
+  return g_string_free_and_steal (result);
 }
 
 static gboolean
@@ -846,7 +846,7 @@ shell_perf_log_dump_events (ShellPerfLog   *perf_log,
 
   g_string_append (output, " ]");
 
-  return write_string (out, g_string_free (output, FALSE), error);
+  return write_string (out, g_string_free_and_steal (output), error);
 }
 
 typedef struct {
index 9bd8d6a7d0f18e91776e57e4cbb746ea6adeb47e..f56a77f80c4b022b9d6b5faeeb10aeb54fcbfe68 100644 (file)
@@ -323,7 +323,7 @@ cr_additional_sel_to_string (CRAdditionalSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
@@ -421,7 +421,7 @@ cr_additional_sel_one_to_string (CRAdditionalSel const *a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
index e641e4ecb84359148634a078ee5be0e5122e46ff..627b2bc2f5e0c69cbf49881193a6e1c3a85d7111 100644 (file)
@@ -168,7 +168,7 @@ cr_attr_sel_to_string (CRAttrSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
         }
 
         return result;
index 1917f62e701868a8e24297dbe4ade59ea50c8c1c..8af67c383fe722efc38f33651e45967d0ee74457 100644 (file)
@@ -539,7 +539,7 @@ cr_declaration_to_string (CRDeclaration const * a_this, gulong a_indent)
                 }
         }
         if (stringue && stringue->str) {
-                result = g_string_free (stringue, FALSE);
+                result = g_string_free_and_steal (stringue);
         }
         return result;
 
@@ -582,7 +582,7 @@ cr_declaration_list_to_string (CRDeclaration const * a_this, gulong a_indent)
                         break;
         }
         if (stringue && stringue->str) {
-                result = (guchar *) g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free_and_steal (stringue);
         }
 
         return result;
@@ -634,7 +634,7 @@ cr_declaration_list_to_string2 (CRDeclaration const * a_this,
                         break;
         }
         if (stringue && stringue->str) {
-                result = (guchar *) g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free_and_steal (stringue);
         }
 
         return result;
index da16cf8839458bd06fc0563f8ad0e70837db3158..e5bc964fc3546324dce7f5b66e8fb55cf96d1b78 100644 (file)
@@ -196,7 +196,7 @@ cr_font_family_to_string (CRFontFamily const * a_this,
                                                 &stringue);
 
         if (status == CR_OK && stringue) {
-                result = (guchar *) g_string_free (stringue, FALSE);
+                result = (guchar *) g_string_free_and_steal (stringue);
                 stringue = NULL;
 
         } else {
index 2b40974130fafb04a71f3575c86448a3c13156bd..0414959ae72e4a38f3b448a353e3491b4c2d41cf 100644 (file)
@@ -126,7 +126,7 @@ cr_parsing_location_to_string (CRParsingLocation const *a_this,
                                        a_this->byte_offset) ;
        }
        if (result->len) {
-               str = g_string_free (result, FALSE) ;
+               str = g_string_free_and_steal (result) ;
        } else {
                g_string_free (result, TRUE) ;
        }
index f81f9a6e6a3e8b8eff2f926038714012c91d7c6d..843e33abbc4cdb6dff36109a5b74344c722948fd 100644 (file)
@@ -107,7 +107,7 @@ cr_pseudo_to_string (CRPseudo const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
index 4691e961cce6101926b317c9c9027804a11dd7d0..7947450e69cedbfa9308dbf4e4702ded75e6047c 100644 (file)
@@ -273,7 +273,7 @@ cr_rgb_to_string (CRRgb const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
         }
 
         return result;
index 179391194436a0541c699fd1dd4dae7cb88ccb68..269af7f8e56b6121a9452545925509835a595623 100644 (file)
@@ -157,7 +157,7 @@ cr_selector_to_string (CRSelector const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
index 07a53676ca975f3de79d58c7ca7e0f3ba9f418f5..03838b6da2bfd4924a5f911d924de6724d4ce325 100644 (file)
@@ -152,7 +152,7 @@ cr_simple_sel_to_string (CRSimpleSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
@@ -193,7 +193,7 @@ cr_simple_sel_one_to_string (CRSimpleSel const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
index 0596eff53a721e6ece9e98a93170e71222cb38c8..7e404656a744f9a1ad04f892ffb0967d81410708 100644 (file)
@@ -622,7 +622,7 @@ cr_statement_ruleset_to_string (CRStatement const * a_this, glong a_indent)
                 cr_utils_dump_n_chars2 (' ', stringue, a_indent);
         }
         g_string_append (stringue, "}");
-        result = g_string_free (stringue, FALSE);
+        result = g_string_free_and_steal (stringue);
 
         g_clear_pointer (&tmp_str, g_free);
         return result;
@@ -671,7 +671,7 @@ cr_statement_font_face_rule_to_string (CRStatement const * a_this,
                 g_string_append (stringue, "\n}");
         }
         if (stringue) {
-                result = g_string_free (stringue, FALSE);
+                result = g_string_free_and_steal (stringue);
                 stringue = NULL ;
         }
         return result ;
@@ -714,7 +714,7 @@ cr_statement_charset_to_string (CRStatement const *a_this,
                 g_clear_pointer (&str, g_free);
         }
         if (stringue) {
-                str = g_string_free (stringue, FALSE);
+                str = g_string_free_and_steal (stringue);
         }
         return str ;
 }
@@ -767,7 +767,7 @@ cr_statement_at_page_rule_to_string (CRStatement const *a_this,
                 }
                 g_string_append (stringue, "\n}\n");
         }
-        result = g_string_free (stringue, FALSE) ;
+        result = g_string_free_and_steal (stringue) ;
         stringue = NULL ;
         return result ;
 }
@@ -828,7 +828,7 @@ cr_statement_media_rule_to_string (CRStatement const *a_this,
                 g_string_append (stringue, "\n}");
         }
         if (stringue) {
-                str = g_string_free (stringue, FALSE) ;
+                str = g_string_free_and_steal (stringue) ;
         }
         return str ;
 }
@@ -888,7 +888,7 @@ cr_statement_import_rule_to_string (CRStatement const *a_this,
                 g_string_append (stringue, " ;");
         }
         if (stringue) {
-                str = g_string_free (stringue, FALSE) ;
+                str = g_string_free_and_steal (stringue) ;
                 stringue = NULL ;
         }
         return str ;
@@ -2544,7 +2544,7 @@ cr_statement_list_to_string (CRStatement const *a_this, gulong a_indent)
                         str = NULL ;
                 }                
         }
-        str = g_string_free (stringue, FALSE) ;
+        str = g_string_free_and_steal (stringue) ;
         return str ;
 }
 
index 63e763feb71f5874828a963496366949cf12488c..016daeb36232d3ec99f5c6e9e7fcbe45f66b639c 100644 (file)
@@ -82,7 +82,7 @@ cr_stylesheet_to_string (CRStyleSheet const *a_this)
                }
         }
        if (stringue) {
-               str = g_string_free (stringue, FALSE) ;
+               str = g_string_free_and_steal (stringue) ;
                stringue = NULL ;
        }
        return str ;
index 669594ecbc332f2e8d5a679f222a7081d71afbbb..720293c81c84b1733943cf9fc2c2127d94e3502a 100644 (file)
@@ -462,7 +462,7 @@ cr_term_to_string (CRTerm const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
@@ -656,7 +656,7 @@ cr_term_one_to_string (CRTerm const * a_this)
         }
 
         if (str_buf) {
-                result = (guchar *) g_string_free (str_buf, FALSE);
+                result = (guchar *) g_string_free_and_steal (str_buf);
                 str_buf = NULL;
         }
 
index 7cfea44b8a080e62ac948ad148b3a00cb29b4a9f..8b8140f9ed3c60cfa6289b996830e05013e03b99 100644 (file)
@@ -2960,7 +2960,7 @@ font_family_from_terms (CRTerm *term,
  out:
   if (result)
     {
-      *family = g_string_free (family_string, FALSE);
+      *family = g_string_free_and_steal (family_string);
       return TRUE;
     }
   else
@@ -4555,5 +4555,5 @@ st_theme_node_to_string (StThemeNode *node)
 
   g_string_append_c (desc, ']');
 
-  return g_string_free (desc, FALSE);
+  return g_string_free_and_steal (desc);
 }
index ea19043f502ef3a3aca591fedfe8b63576c2f00a..72c7e8adc78c99069f636fb80f5aa2d977344282 100644 (file)
@@ -2323,7 +2323,7 @@ st_describe_actor (ClutterActor *actor)
 
   g_string_append_c (desc, ']');
 
-  return g_string_free (desc, FALSE);
+  return g_string_free_and_steal (desc);
 }
 
 /**
index 51fa061089e24b0fb801da991073d0db1cf5a383..56a410e332ccd0df33e652ab3b76504f13776d37 100644 (file)
@@ -100,7 +100,7 @@ text_decoration_to_string (StTextDecoration decoration)
   else
     g_string_append(result, "none");
 
-  return g_string_free (result, FALSE);
+  return g_string_free_and_steal (result);
 }
 
 static void
index 9ec6670333a2f5ff8cc6397a7a3fd156bc91cf37..0d445a7d5d18e77be53396ee284130944c33aa78 100644 (file)
@@ -149,7 +149,7 @@ latin1_to_utf8 (const char *latin1)
       ++p;
     }
 
-  return g_string_free (str, FALSE);
+  return g_string_free_and_steal (str);
 }
 
 /* derived from libwnck/xutils.c, comes as LGPLv2+ */